#!/bin/bash

PROTOC_EXE_PATH="/e/RO_FOR_CLIENT/clientproj/Tools/Protobuf/protoc.exe"
PROTO_FILES_PATH="E:/RO_FOR_CLIENT/config/AutoGen/protobuf/cpp"
GENERATE_PATH="ropb"

export PATH="${PATH}:${GOPATH//;/}/bin"

set -e
[[ -d __tmp ]] && rm -rf __tmp
mkdir -p __tmp || mkdir -p ${GENERATE_PATH}
cp ${PROTO_FILES_PATH}/* __tmp -rf

# 添加go用的模块名
sed -i '3aoption go_package="./;KKSG";' __tmp/*.proto

${PROTOC_EXE_PATH} __tmp/*.proto  -I __tmp --go_out="${GENERATE_PATH}"
rm -rf __tmp
